package edu.kit.ksri.db.mturk.plugins.display;

import java.util.ArrayList;
import java.util.List;

/**
 * Copyright (c) 2010-2011 Karlsruhe Institute of Technology (KIT), Germany
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 * 
 * --------------------------------------------------------------------------
 * 
 * Software: CSP/WMV tool for dynamic quality management of microtasks
 * http://www.ksri.kit.edu/Upload/Users/PeopleClouds/HCOMP2011_An_extendable_toolkit_for_managing_quality_of_human-based_eServices.pdf
 * 
 * Organization: Karlsruhe Institute of Technology (KIT), Germany
 * http://www.kit.edu
 * 
 * Project: PeopleClouds project of the Karlsruhe Service Research Institute(KSRI)
 * http://www.ksri.kit.edu/Default.aspx?PageId=818
 * 
 * Contributing authors: David Bermbach, Sandra Rath, Pascal Wichmann, Robert Kern
 * 
 * ---------------------------------------------------------------------------
 * 
 * Purpose: This is part of the live demo monitoring tool. Each object resembles one row in the HTML table.
 *          Each row is for one HIT.
 */
public class BrowserDisplayRow {
	
	private int mappingNumber;
	private String hitID;
	private String task;
	private String status;
	private List<String> answers;
	private String correctAnswer;
	
	/**
	 * Creates a row for the HTML table
	 * 
	 * @param mappingNumber
	 * @param hitID
	 * @param task
	 * @param status
	 */
	public BrowserDisplayRow(int mappingNumber, String hitID, String task, String status){
		this.mappingNumber = mappingNumber;
		this.hitID = hitID;
		this.task = task;
		this.status = status;
		this.answers = new ArrayList<String>();
	}
	
	/**
	 * Sets the status of the result/HIT
	 * 
	 * @param status
	 */
	public void setStatus(String status){
		this.status = status;
	}

	/**
	 * Adds a raw answer
	 * 
	 * @param answer
	 * 
	 */
	public void addAnswer(String answer){
		this.answers.add(answer);
	}
	
	/**
	 * Returns the mapping number
	 * 
	 * @return Mapping Number
	 * 
	 */
	public int getMappingNumber(){
		return mappingNumber;
	}
	
	/**
	 * Returns the HIT ID
	 * 
	 * @return HIT ID
	 * 
	 */
	public String getHitID(){
		return hitID;
	}
	
	/**
	 * Returns the task of the HIT, the OCR image for instance
	 * 
	 * @return Task
	 * 
	 */
	public String getTask(){
		return task;
	}
	
	/** 
	 * Returns the status of the result/HIT
	 * 
	 * @return Status
	 */
	public String getStatus(){
		return status;
	}
	
	/**
	 * Returns all the answers for a HIT
	 * 
	 * @return Answer
	 * 
	 */
	public List<String> getAnswers(){
		return answers;
	}
	
	/**
	 * Returns the correct answer of a HIT
	 * 
	 * @return Correct Answer
	 * 
	 */
	public String getCorrectAnswer(){
		return correctAnswer;
	}
	
	/**
	 * Sets the correct answer of a HIT
	 * 
	 * @param correctAnswer
	 * 
	 */
	public void setCorrectAnswer(String correctAnswer){
		this.correctAnswer = correctAnswer;
	}
}
